﻿//5.	压力容器总数据量的检验结论统计
var data = [
    {name: '1 级', value: 5031},
    {name: '2 级', value: 20530},
    {name: '3 级', value: 21337},
    {name: '4 级', value: 654},
    {name: '5 级', value: 21},
    {name: '不合格', value: 149},
    {name: '合格', value: 108718},
    {name: '监督运行', value: 943},
    {name: '其他', value: 58347},
    {name: '停止运行', value: 87},
    {name: '修理后复检', value: 26},
    {name: '允许使用', value: 7124},
    {name: '整改后使用', value: 73}
];
var xData_106_ = [],
    yData_106_ = [];
var min = 0;
data.map(function(a, b) {
    xData_106_.push(a.name);
    if (a.value === 0) {
        yData_106_.push(a.value + min);
    } else {
        yData_106_.push(a.value);
    }
});
option106 = {
    // backgroundColor:"#111c4e",
    color: ['#3398DB'],
    tooltip: {
        trigger: 'axis',
        axisPointer: {
            type: 'line',
            lineStyle: {
                opacity: 0
            }
        },
        formatter: function(prams) {
            if (prams[0].data === min) {
                return "合格率：0%"
            } else {
                // return "合格率：" + prams[0].data + "%"
                // return prams[0].name+"<br>数量：" + prams[0].data
                var sum = 0;
                for(var x=0;x<data.length;x++){
                    sum = sum + data[x].value
                }
                // console.log(sum)
                return prams[0].name+"<br>数量：" + prams[0].data+ '<br>' + '占比：' + (prams[0].data / sum * 100).toFixed(2) + '%,总数:'+sum;
            }
        }
    },
    legend: {
        data: ['直接访问', '背景'],
        show: false
    },
    grid: {
        left: '0%',
        right: '0%',
        bottom: '5%',
        top: '7%',
        height: '85%',
        containLabel: true,
        z: 22
    },
    xAxis: [{
        type: 'category',
        gridIndex: 0,
        data: xData_106_,
        axisTick: {
            alignWithLabel: true
        },
        axisLine: {
            lineStyle: {
                color: '#0c3b71'
            }
        },
        axisLabel: {
            show: true,
            // color: 'rgb(170,170,170)',
            // fontSize:16,
            textStyle: {
                color: '#fff',
                fontSize: '16'
            },
            rotate:40 ,
        }
    }],
    yAxis: [{
        type: 'value',
        gridIndex: 0,
        splitLine: {
            show: false
        },
        axisTick: {
            show: false
        },
        min: min,
        max: 120000,
        axisLine: {
            lineStyle: {
                color: '#0c3b71'
            }
        },
        axisLabel: {
            // color: 'rgb(170,170,170)',
            formatter: '{value} ',
            textStyle: {
                color: '#fff',
                fontSize: '16'
            },
        }
    },
        {
            type: 'value',
            gridIndex: 0,
            min: min,
            max: 120000,
            splitNumber: 12,
            splitLine: {
                show: false
            },
            axisLine: {
                show: false
            },
            axisTick: {
                show: false
            },
            axisLabel: {
                show: false
            },
            splitArea: {
                show: true,
                areaStyle: {
                    color: ['rgba(250,250,250,0.0)', 'rgba(250,250,250,0.05)']
                }
            }
        }
    ],
    series: [{
        name: ' ',
        type: 'bar',
        barWidth: '30%',
        xAxisIndex: 0,
        yAxisIndex: 0,
        label: {
            normal: {
                show: true,
                "position": "top",
                "textStyle": {
                    "color": "#fff"
                },
            }
        },
        itemStyle: {
            normal: {

                barBorderRadius: 30,
                color: new echarts.graphic.LinearGradient(
                    0, 0, 0, 1, [{
                        offset: 0,
                        color: '#00feff'
                    },
                        {
                            offset: 0.5,
                            color: '#027eff'
                        },
                        {
                            offset: 1,
                            color: '#0286ff'
                        }
                    ]
                )
            }
        },
        data: yData_106_,
        zlevel: 11

    },
        {
            name: '背景',
            type: 'bar',
            barWidth: '50%',
            xAxisIndex: 0,
            yAxisIndex: 1,
            barGap: '-135%',
            data: [120000, 120000, 120000, 120000, 120000, 120000, 120000,120000, 120000, 120000, 120000, 120000, 120000],
            itemStyle: {
                normal: {
                    color: 'rgba(255,255,255,0.1)'
                }
            },
            zlevel: 9
        },

    ]
};

